<!DOCTYPE HTML>
<html>
<head>
    <title>Print the KeyCode</title>
    <meta content="text/html" charset="UTF-8">
    <script type="text/javascript" src="../jQuery/jquery-1.7.1.js"></script>
</head>
<body>
<div>
	<h1>键盘代码：<span id="print"></span></h1>
</div>

<script type="text/javascript">
    var uiPrint = $("#print");
//    $(window).keydown(function(e)
//    {
//        var keyCode = e.keyCode;
//        uiPrint.html(keyCode);
//    });

    window.addEventListener('keydown',function(e){
        var keyCode = e.keyCode;
        uiPrint.html(keyCode);
    });
</script>
</body>
</html>